﻿@using SimpleScrum.Areas.Scrum.Models
@using SimpleScrum.Core.Entities
@using SimpleScrum.Helpers
@model SimpleScrum.Core.Entities.Project
@{
    ViewBag.Title = "New Project";
    var setting=1;
    var org = new OrganizationModel();
    var projectModel = new ProjectModel();
    var existOrg = org.GetOrganizations();
    if (existOrg.Count == 1)
    {
        foreach (var organization in existOrg)
        {
            organization.ProjectCollection = projectModel.GetProjects(organization.Id).ToList();
            if (organization.ProjectCollection.Count == 0)
            {
                Layout = "~/Areas/Scrum/Views/Shared/_Layout.cshtml";
                setting = 0;
            }
        }
    }
}
@if (setting == 1)
{

    <div class="breadcrumbs" id="breadcrumbs">
        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="@Url.Action("Index","DashBoard")">Home</a>
                <span class="divider">
                    <i class="icon-angle-right arrow-icon"></i>
                </span>
            </li>
            <li>
                <a href="@Url.Action("Index", "Project")">Projects</a>
                <span class="divider">
                    <i class="icon-angle-right arrow-icon"></i>
                </span>
            </li>
            <li class="active">New</li>
        </ul>
        <div class="nav-search pull-right">
            <a class="btn btn-small btn-grey" href="@Url.Action("Index", "Project")">
                <i class="icon-list-alt"></i> All Projects
            </a>
        </div>
    
    </div>
}
<div class="page-content">
    <div class="page-header position-relative">
        <h1>@ViewBag.Title<small><i class="icon-double-angle-right"></i>@ViewBag.Message</small></h1>
    </div>
    <!--/.page-header-->
    <div class="row-fluid">
        <div class="span12">
            <div class="widget-box form-horizontal">
                <div class="widget-header">
                    <h4>Insert Project Information New Form</h4>
                </div>
                <div class="widget-body">
                    <div class="widget-main no-padding">
                        @using (Html.BeginForm())
                        {
                            @Html.AntiForgeryToken()
                            <div class="text-error">
                                @Html.ValidationSummary("Please enter valid Data!")
                            </div>
                            <fieldset>
                                <div class="control-group">
                                    @Html.LabelFor(model => model.Name, new { @class = "control-label", @for = "form-field-1" })
                                    <div class="controls">
                                        @Html.TextBoxFor(model => model.Name, new { @class = "span10", @id = "form-field-1", @placeholder = "Project Name" })
                                        <span class="help-inline">*</span>
                                        <div class="text-warning">@Html.ValidationMessageFor(model => model.Name)</div>
                                    </div>
                                </div>
                                <div class="control-group">
                                    @Html.LabelFor(model => model.Description, new { @class = "control-label", @for = "form-field-2" })
                                    <div class="controls">
                                        @Html.TextAreaFor(model => model.Description, new { @class = "span10 limited", id = "form-field-2", @rows = "5", placeholder = "Project Description" })
                                        <div class="text-warning">@Html.ValidationMessageFor(model => model.Description)</div>
                                    </div>
                                </div>
                                <div class="control-group">
                                    @Html.LabelFor(model => model.Status, new { @class = "control-label", @for = "form-field-3" })
                                    <div class="controls">
                                        @Html.DropDownListFor(model => model.Status, new SelectList(EnumHelper.GetEnumInfo(typeof(Project.StatusEnum)), "ID", "Name"))
                                   
                                        <span class="help-inline">*</span>
                                        @*<div class="text-warning">@Html.ValidationMessageFor(model => model.Name)</div>*@
                                    </div>
                                </div>
                            </fieldset>
                            <div class="form-actions center">
                                <button class="btn btn-success" value="Save">
                                    <i class="icon-ok bigger-110"></i>Save
                                </button>
                            </div>
                        }
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}